Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capture_(request|response)_headers to instrument_httpx #671

Merged
merged 16 commits into from
Dec 17, 2024

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Dec 13, 2024

No description provided.

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b375af7) to head (810ddd9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #671    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          137       137            
  Lines        10721     10835   +114     
  Branches      1470      1488    +18     
==========================================
+ Hits         10721     10835   +114     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cloudflare-workers-and-pages bot commented Dec 16, 2024

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 810ddd9
Status: ✅  Deploy successful!
Preview URL: https://b49d923f.logfire-docs.pages.dev
Branch Preview URL: https://alex-httpx-headers.logfire-docs.pages.dev

View logs

@Kludex Kludex requested a review from alexmojaki December 16, 2024 10:44
Copy link
Contributor

@alexmojaki alexmojaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to handle and test passing a sync hook for an async client when headers aren't being captured

logfire/_internal/integrations/httpx.py Show resolved Hide resolved
logfire/_internal/integrations/httpx.py Outdated Show resolved Hide resolved
async_request_hook = cast('AsyncRequestHook | None', final_kwargs.get('async_request_hook'))
async_response_hook = cast('AsyncResponseHook | None', final_kwargs.get('async_response_hook'))

if capture_request_headers: # pragma: no cover
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking, but things here are getting complicated enough that this is worth testing. it could either make a real request or a mini local server could be set up in another thread.

@Kludex Kludex requested a review from alexmojaki December 16, 2024 13:50
logfire/_internal/main.py Outdated Show resolved Hide resolved
client: None,
capture_request_headers: bool = False,
capture_response_headers: bool = False,
**kwargs: Unpack[HTTPXInstrumentKwargs],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still want to get rid of these Unpacks and kwargs eventually.

@Kludex Kludex enabled auto-merge (squash) December 17, 2024 13:36
@Kludex Kludex merged commit 1715155 into main Dec 17, 2024
14 checks passed
@Kludex Kludex deleted the alex/httpx-headers branch December 17, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants